/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.MRP.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class ConsolidatedMonthlySalesRecordEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private String id;
    
    private Integer yearInt;
    private Integer monthInt;
    
    private int actualSales;
    private int actualPromotion;
    private int actualBase;
    private int projectedSales;
    private int projectedPromotion;
    private int projectedBase;
    private int previousSales;
    private int previousPromotion;
    private int previousBase;
    private int growth;
    private int productionPlan;
    private int endingInventory; //expected figures
    private int nWorkdays;
    private int capacity;
    private int utilization;
    private Collection<Object[]> compositions;
    
    private boolean forecasted;
    private boolean finalized;
    private boolean deleted;
    
    @OneToMany(mappedBy = "consolidatedMonthlySalesRecordEntity")
    private Collection<MonthlySalesRecordEntity> monthlySalesRecords;
    @OneToMany(mappedBy = "consolidatedMonthlySalesRecordEntity")
    private Collection<PlannedMonthlyDemandEntity> plannedMonthlyDemands;

    public ConsolidatedMonthlySalesRecordEntity () {
        this.finalized = false;
        this.deleted = false;
    }
    
    public ConsolidatedMonthlySalesRecordEntity(Integer yearInt, Integer monthInt) {
        String stringId = "CMSR" + yearInt.toString() + "-" + monthInt;
        this.id = stringId;
        this.yearInt = yearInt;
        this.monthInt = monthInt;
        this.monthlySalesRecords = null;
        this.plannedMonthlyDemands = null;
        this.finalized = false;
        this.deleted = false;
    }


    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getMonthInt() {
        return monthInt;
    }

    public void setMonthInt(Integer monthInt) {
        this.monthInt = monthInt;
    }

    public Integer getYearInt() {
        return yearInt;
    }

    public boolean isForecasted() {
        return forecasted;
    }

    public void setForecasted(boolean forecasted) {
        this.forecasted = forecasted;
    }
    
    public void setYearInt(Integer yearInt) {
        this.yearInt = yearInt;
    }

    public int getCapacity() {
        return capacity;
    }

    public void setCapacity(int capacity) {
        this.capacity = capacity;
    }
    
    public int getnWorkdays() {
        return nWorkdays;
    }

    public void setnWorkdays(int nWorkdays) {
        this.nWorkdays = nWorkdays;
    }

    public int getUtilization() {
        return utilization;
    }

    public void setUtilization(int utilization) {
        this.utilization = utilization;
    }

    public int getProductionPlan() {
        return productionPlan;
    }

    public void setProductionPlan(int productionPlan) {
        this.productionPlan = productionPlan;
    }

    public int getEndingInventory() {
        return endingInventory;
    }

    public void setEndingInventory(int endingInventory) {
        this.endingInventory = endingInventory;
    }

    
    public int getGrowth() {
        return growth;
    }

    public void setGrowth(int growth) {
        this.growth = growth;
    }

    public boolean isFinalized() {
        return finalized;
    }

    public void setFinalized(boolean finalized) {
        this.finalized = finalized;
    }

    public boolean isDeleted() {
        return deleted;
    }

    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }

    
    
    public int getActualBase() {
        return actualBase;
    }

    public void setActualBase(int actualBase) {
        this.actualBase = actualBase;
    }

    public int getActualPromotion() {
        return actualPromotion;
    }

    public void setActualPromotion(int actualPromotion) {
        this.actualPromotion = actualPromotion;
    }

    public int getActualSales() {
        return actualSales;
    }

    public void setActualSales(int actualSales) {
        this.actualSales = actualSales;
    }

    public Collection<MonthlySalesRecordEntity> getMonthlySalesRecords() {
        return monthlySalesRecords;
    }

    public void setMonthlySalesRecords(Collection<MonthlySalesRecordEntity> monthlySalesRecords) {
        this.monthlySalesRecords = monthlySalesRecords;
    }

    public Collection<PlannedMonthlyDemandEntity> getPlannedMonthlyDemands() {
        return plannedMonthlyDemands;
    }

    public void setPlannedMonthlyDemands(Collection<PlannedMonthlyDemandEntity> plannedMonthlyDemands) {
        this.plannedMonthlyDemands = plannedMonthlyDemands;
    }

    public int getProjectedBase() {
        return projectedBase;
    }

    public void setProjectedBase(int projectedBase) {
        this.projectedBase = projectedBase;
    }

    public int getProjectedPromotion() {
        return projectedPromotion;
    }

    public void setProjectedPromotion(int projectedPromotion) {
        this.projectedPromotion = projectedPromotion;
    }

    public int getProjectedSales() {
        return projectedSales;
    }

    public void setProjectedSales(int projectedSales) {
        this.projectedSales = projectedSales;
    }

    public int getPreviousBase() {
        return previousBase;
    }

    public void setPreviousBase(int previousBase) {
        this.previousBase = previousBase;
    }

    public int getPreviousPromotion() {
        return previousPromotion;
    }

    public void setPreviousPromotion(int previousPromotion) {
        this.previousPromotion = previousPromotion;
    }

    public int getPreviousSales() {
        return previousSales;
    }

    public void setPreviousSales(int previousSales) {
        this.previousSales = previousSales;
    }

    public Collection<Object[]> getCompositions() {
        return compositions;
    }

    public void setCompositions(Collection<Object[]> compositions) {
        this.compositions = compositions;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ConsolidatedMonthlySalesRecordEntity)) {
            return false;
        }
        ConsolidatedMonthlySalesRecordEntity other = (ConsolidatedMonthlySalesRecordEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Merlion.MRP.entity.ConsolidatedMonthlySalesRecordEntity[ id=" + id + " ]";
    }
}
